package com.family.floor.service.impl;

import com.family.floor.controller.vo.InformationAndfloorVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.family.common.utils.PageUtils;
import com.family.common.utils.Query;

import com.family.floor.dao.InformationDao;
import com.family.floor.entity.InformationEntity;
import com.family.floor.service.InformationService;


@Service("informationService")
public class InformationServiceImpl extends ServiceImpl<InformationDao, InformationEntity> implements InformationService {
    @Autowired
    private InformationDao informationDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<InformationEntity> wrapper = new QueryWrapper<>();
        if(null!=params.get("tid")&&!"".equals(params.get("tid"))){
            wrapper.eq("type_id",params.get("tid"));
        }
        IPage<InformationEntity> page = this.page(
                new Query<InformationEntity>().getPage(params),
                wrapper
        );

        return new PageUtils(page);
    }

    @Override
    public InformationEntity lastInformation() {
        return informationDao.lastInformation();
    }

    @Override
    public InformationAndfloorVo informationDetail(Integer id) {
        return informationDao.informationDetail(id);
    }

}